<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>订餐系统-后台管理</title>
    <link rel="stylesheet" href="/public/admin/assets/css/public.css">
    <style>
        .pagin-list a {
            display: inline-block;
            background-color: rgba(153,255,255,0.6);
            border: 1px solid skyblue;
            color: black;
        }
    </style>
</head>
<body>
    <header class="clearfix owf">
        <div class="logo pull-left">
            <a href="/" class="owf"><img src="/public/admin/assets/images/logo.png" alt="点餐系统" class="pull-left"> <span class="logo-text pull-left">点餐系统-后台管理</span></a>
        </div>
        <div class="user-info pull-right">
            <table>
                <tr>
                    <td><div class="welcom-text">你好，欢迎您 <?php echo ($_SESSION['admin']['username']); ?></div></td>
                    <td><div class="user-icon">
                        <div class="logo-img"></div>
                    </div></td>
                    <td><span class="logout">退出</span></td>
                </tr>
            </table>
        </div>
    </header>
    <div class="content">
        <div class="pull-left silde-bar">
            <br>
            <br>
            <div class="left-menu-item ">
                <div class="top-radius"></div>
                <div class="center-icon">
                    <i class="iconfont">&#xe623;</i>
                    <h3>订单管理</h3>
                </div>
                <div class="bottom-radius"></div>
            </div>
            <div class="left-menu-item left-menu-active">
                <div class="top-radius"></div>
                <div class="center-icon">
                    <i class="iconfont">&#xe623;</i>
                    <h3>商品信息维护</h3>
                </div>
                <div class="bottom-radius"></div>
            </div>
            <div class="left-menu-item">
                <div class="top-radius"></div>
                <div class="center-icon">
                    <i class="iconfont">&#xe623;</i>
                    <h3>支付二维码</h3>
                </div>
                <div class="bottom-radius"></div>
            </div>
        </div>
        <div class="content-main">
            <div class="page-title">
                <h1>商品信息维护</h1>
            </div>
            <div class="box">
                <div class="box-head-title">条件查询</div>
                <div class="box-body clearfix">
                    <div class="pull-left form-input">
                        <label class="form-input-title">菜品名称</label>
                        <input type="text" name="name" class="input-controller" value="<?php echo ($_SESSION['admin']['foodname']); ?>">
                    </div>
                    <div class="pull-left form-input">
                        <label class="form-input-title">是否在售</label>
                        <select name="status" class="form-select">
                            <option value="0">是</option>
                            <option value="1">否</option>
                        </select>
                    </div>
                    <div class="pull-left form-input">
                        <button class="button button-default" id="search">查询</button>
                    </div>
                    <div class="pull-left form-input">
                        <button class="button button-default" id="reset">重置</button>
                    </div>
                    <div class="pull-left form-input">
                        <button class="button button-default" id="add">新增</button>
                    </div>
                </div>
            </div>
            <div>
                <button class="button button-default size-large" id="importOut">导出报表</button>
            </div>

            <div class="box full-width">
                <div class="box-body">
                    <table class="table-controller">
                        <thead>
                            <th>序号</th>
                            <th>菜品名称</th>
                            <th>菜品简介</th>
                            <th>菜品图片</th>
                            <th>菜品价格<span class="red">（元）</span></th>
                            <th>是否在售</th>
                            <th>操作</th>
                        </thead>
                        <tbody>
                            <?php if(is_array($data)): foreach($data as $key=>$val): ?><tr>
                                <td><?php echo ($val["id"]); ?></td>
                                <td><?php echo ($val["foodname"]); ?></td>
                                <td><?php echo ($val["foodconstruct"]); ?></td>
                                <td><img src="<?php echo ($val["foodimg"]); ?>" alt="" width="120" height="103"></td>
                                <td><?php echo ($val["foodprice"]); ?></td>
                                <td>
                                    <?php if($val["issale"] == 0): ?>是
                                    <?php else: ?>
                                    否<?php endif; ?>
                                </td>
                                <td>
                                    <a href="/admin/product/editData/id/<?php echo ($val["id"]); ?>" class="opation"><i class="iconfont">&#xe604;</i></a>
                                    <a href="/admin/product/delData/id/<?php echo ($val["id"]); ?>" class="opation"><i class="iconfont">&#xe659;</i></a>
                                </td>
                            </tr><?php endforeach; endif; ?>
                        </tbody>
                    </table>

                    <div class="fenye clearfix">
                        <div class="pull-left">
                            <select name="page-size" class="form-select">
                                <option value="5">显示5条</option>
                                <option value="8">显示8条</option>
                                <option value="10">显示10条</option>
                                <option value="15">显示15条</option>
                            </select>
                        </div>
                        <div class="pull-left fenye-container">
                            <div class="pagin-list">
                                <?php echo ($show); ?>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
<script src="/public/admin/assets/js/jquery.min.js"></script>
<script>
    $(function() {
        // 显示条数
        $("select[name='page-size']").find("option[value='"+<?php echo ($num); ?>+"']").attr('selected', 'selected')
        // 导出报表
        $('#importOut').click(function(){
            window.location.href = "<?php echo U('/admin/product/importout');?>"
        })
        // 登出
        $('.logout').click(function(){
            window.location.href = "<?php echo U('/admin/public/logout');?>"
        })
        // 新增
        $('#add').click(function(){
            window.location.href = "<?php echo U('/admin/product/add');?>"
        })
        // 重置
        $('#reset').click(function(){
            window.location.href = "<?php echo U('/admin/product/index');?>"
        })
        // 显示一页多少条数
        $("select[name='page-size']").change(function(){
            var number = $("select[name='page-size']").val()
            window.location.href = '/admin/product/search/num/'+number
        })
        // 查询
        $('button').eq(0).click(function(){
            var foodname = $('.input-controller').val()
            var issale = $("select[name='status']").val()
            if(!foodname){foodname = '0'}
            window.location.href = '/admin/product/search/foodname/'+foodname+'/issale/'+issale
        })
       
    })
</script>
</html>